#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
const int maxn = 5e5+10;
int a[maxn];
struct node
{
	int val;
	int x;
	int ans;
	int fa[100];
}b[maxn];
bool cmp(node a,node b)
{
	return a.val<b.val;
}
using namespace std;
int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i = 1;i<=n;i++)
	{
		b[i].val = 0;
		b[i].x = i;
	}
	for(int i = 0;i<m;i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		b[x].val++;
		b[y].val++;
		b[x].fa[b[x].val] = y;
		b[y].fa[b[y].val] = x;
	}
	for(int i = 1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	sort(b+1,b+n+1,cmp);
	int flag = 0;
	for(int i = 1;i<=n;i++)
	{
		b[i].ans = i;
		for(int it = 1;it <= b[i].val;it++)
		{
			int x = b[i].fa[it];
			if(a[x]==a[b[i].x])
			{
				flag = 1;
				break;
			}
		}
		if(flag) break;
	}
	if(flag) printf("-1\n");
	else 
	{
		for(int i = 1;i<=n;i++)
		{
			a[b[i].x] = b[i].ans;
		}
		for(int i = 1;i<=n;i++)
		{
			if(i==1) printf("%d",a[i]);
			else printf(" %d",a[i]);
		}
		printf("\n");
	}
}
